<template>
  <view class="hb-flex hb-items-center hb-rounded-lg hb-p-3 hb-bg-[#F7F8FA] hb-mt-3">
    <TmImage :src="data.avatar" :height="80" :width="80" :round="25" error-img-type="person" />
    <view class="hb-ml-2 hb-flex-1">
      <view class="hb-flex hb-items-center hb-mb-1">
        <TmText
          :label="data.userName"
          _class="hb-font-bold text-overflow-1 hb-mr-1"
          :font-size="32"
        />
        <RoleTag
          v-if="data.roleType === RoleTypeEnum.SUPER_ADMIN"
          type="superAdmin"
          text="超级管理员"
        />
        <RoleTag v-else type="admin" text="管理员" />
      </view>
      <TmText label="全部权限" color="#969799" :font-size="24" />
    </view>
    <view
      v-if="data.roleType !== RoleTypeEnum.SUPER_ADMIN"
      class="hb-pl-4 hb-h-10 hb-flex hb-items-center"
      @click="emits('delete')"
    >
      <TmIcon name="ali-icon icon-shanchu" :font-size="32" />
    </view>
    <view class="hb-pl-4 hb-h-10 hb-flex hb-items-center" @click="emits('setting')">
      <TmIcon name="ali-icon icon-shezhi1" color="#969799" :font-size="32" />
    </view>
  </view>
</template>

<script setup lang="ts">
  import { BotAdminPageListResult } from '@/api/aiSettings/types';
  import { RoleTypeEnum } from '@/enums/LoginEnum';

  defineProps<{
    data: BotAdminPageListResult;
  }>();

  const emits = defineEmits<{
    (e: 'delete'): void;
    (e: 'setting'): void;
  }>();
</script>

<style scoped></style>
